//THANKS TO ANMABAGIMA (PSPKING)

#include "timebase.h"

Timebase::Timebase()
{
    sceRtcGetCurrentTick(&lastTick);
    firstTick = lastTick;
    tickFrequency = 1.0f / sceRtcGetTickResolution();
    reseted = false;
}

float Timebase::getDeltaSeconds(){
    u64 currTick;
    sceRtcGetCurrentTick(&currTick);
    
    return ((currTick - lastTick)*tickFrequency);
}

float Timebase::getTime(){
    u64 currTick;
    sceRtcGetCurrentTick(&currTick);

    return ((currTick - firstTick)*tickFrequency);
}

void Timebase::reset()
{
    sceRtcGetCurrentTick(&lastTick);
    reseted = true;
}

bool Timebase::isReset()
{
    return reseted;
}